<include file="public@header"/>
</head>
<body>
<div class="wrap">
    <ul class="nav nav-tabs">
        <li class="active"><a>详情</a></li>
    </ul>
    <form method="post" class="form-horizontal js-ajax-form margin-top-20" action="{:url('doedit')}">

        <div class="form-group">
            <label for="js-smtpsecure" class="col-sm-2 control-label">
                供应商
            </label>
            <div class="col-md-6 col-sm-10">
                <select name="lid" class="form-control">
                    <option value="{$res.lid}">{$res.lName}</option>
                    <volist name="some" id="v">
                        <option value="{$v.id}">{$v['attrName']}</option>
                    </volist>
                </select>
            </div>
        </div>

    

        <input type="hidden" name="id" value="{$res['id']}">

        <div class="form-group">
            <div class="col-sm-offset-2 col-sm-10">
                <button type="submit" class="btn btn-primary js-ajax-submit">{:lang('SAVE')}</button>
                <a class="btn btn-default" href="javascript:history.back(-1);">{:lang('BACK')}</a>
            </div>
        </div>
    </form>
</div>
<script src="__STATIC__/js/admin.js"></script>
<script>
    // 页面加载时初始化班组
    function initializeTeamDisplay() {
        const nameSelect = document.getElementById('nameSelect');
        const selectedOption = nameSelect.options[nameSelect.selectedIndex];
        if (selectedOption) {
            const typeValue = selectedOption.getAttribute('data-type');
            const teamDisplay = document.getElementById('teamDisplay');
            teamDisplay.value = typeValue || ''; // 设置班组输入框的值
        }
    }

    // 姓名选择框联动班组
    document.getElementById('nameSelect').addEventListener('change', function () {
        const selectedOption = this.options[this.selectedIndex];
        if (selectedOption) {
            const typeValue = selectedOption.getAttribute('data-type');
            const teamDisplay = document.getElementById('teamDisplay');
            teamDisplay.value = typeValue || ''; // 设置班组输入框的值
        }
    });

    // 页面加载时调用初始化函数
    window.addEventListener('DOMContentLoaded', initializeTeamDisplay);
</script>
</body>
</html>